<!DOCTYPE html>
<html lang="en">
<head>
    {template 'common/edithead'}
    <!--微擎 -->
    <!--这个放在最后一切平白安全-->
    <script type="text/javascript" src="./resource/js/require.js?v=20170915"></script>
    <style>
        .type1,.type2,.type3,.apply_code,.fee_type1,.fee_type2{display: none;}
    </style>
</head>
<body class="nav-md" style="min-width: 800px">
<div>
    <div class="container xc_edit_from" >
        <div class="main_container" style="overflow-x: hidden;min-height: calc(100vh - 20px);background-color: white;width: 100%;">
            <div class="col-md-12 col-xs-12">
                <div class="x_panel">
                    {template 'mymanage/webconfig/nav'}
                    <div class="x_content">
                        <br/>
                        <form class="form-horizontal form-label-left input_mask" method="post" action="{php echo $this->createWebUrl($do, array('op'=>'share_save'));}" id="xc_form">
                            <input type="hidden" name="xkey" value="{$keyval}">
                            <label class="control-label col-md-2 col-sm-3 col-xs-12">状态</label>
                            <div class="form-group">
                                <div class="col-md-10 col-sm-9 col-xs-12">
                                    <input type="checkbox" class="js-switch" value="1" name="xc[status]"
                                           data-value="{$xc['status']}" data-field="status">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-2 col-sm-3 col-xs-12">分销级别</label>
                                <div class="col-md-10 col-sm-9 col-xs-12">
                                    <div class="col-md-10 col-sm-9 col-xs-12 xradio" data-value="{$xc['type']}">
                                        <label class="radio inline">
                                            <input type="radio" class="ui-radio" name="xc[type]" value="1" {if $xc['type']==1}checked{/if}>一级分销
                                        </label>
                                        <label class="radio inline">
                                            <input type="radio" class="ui-radio" name="xc[type]" value="2" {if $xc['type']==2}checked{/if}>二级分销
                                        </label>
                                        <label class="radio inline">
                                            <input type="radio" class="ui-radio" name="xc[type]" value="3" {if $xc['type']==3}checked{/if}>三级分销
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group type1">
                                <label class="control-label col-md-2 col-sm-3 col-xs-12">一级分销佣金</label>
                                <div class="col-md-10 col-sm-9 col-xs-12">
                                    <div class="input-group">
                                        <span class="input-group-btn">
                                            <button class="btn btn-default" type="button">消费金额的</button>
                                        </span>
                                        <input type="text" class="form-control" name="xc[referrer_one]" value="{$xc['referrer_one']}" placeholder="佣金">
                                        <span class="input-group-btn">
                                            <button class="btn btn-default" type="button">%</button>
                                        </span>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group type2">
                                <label class="control-label col-md-2 col-sm-3 col-xs-12">二级分销佣金</label>
                                <div class="col-md-10 col-sm-9 col-xs-12">
                                    <div class="input-group">
                                        <span class="input-group-btn">
                                            <button class="btn btn-default" type="button">消费金额的</button>
                                        </span>
                                        <input type="text" class="form-control" name="xc[referrer_two]" value="{$xc['referrer_two']}" placeholder="佣金">
                                        <span class="input-group-btn">
                                            <button class="btn btn-default" type="button">%</button>
                                        </span>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group type3">
                                <label class="control-label col-md-2 col-sm-3 col-xs-12">三级分销佣金</label>
                                <div class="col-md-10 col-sm-9 col-xs-12">
                                    <div class="input-group">
                                        <span class="input-group-btn">
                                            <button class="btn btn-default" type="button">消费金额的</button>
                                        </span>
                                        <input type="text" class="form-control" name="xc[referrer_three]" value="{$xc['referrer_three']}" placeholder="佣金">
                                        <span class="input-group-btn">
                                            <button class="btn btn-default" type="button">%</button>
                                        </span>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-2 col-sm-3 col-xs-12">审核功能</label>
                                <div class="col-md-10 col-sm-9 col-xs-12">
                                    <input type="checkbox" class="js-switch" value="1" name="xc[apply_status]"
                                           data-value="{$xc['apply_status']}" data-field="status">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-2 col-sm-3 col-xs-12">审核图片</label>
                                <div class="col-md-10 col-sm-9 col-xs-12">
                                    {php echo tpl_form_field_image('xc[apply_img]',$xc['apply_img']);}
                                    <span class="help-block">750*360</span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-2 col-sm-3 col-xs-12">审核验证码</label>
                                <div class="col-md-10 col-sm-9 col-xs-12">
                                    <input type="checkbox" class="js-switch" value="1" name="xc[apply_code]"
                                           data-value="{$xc['apply_code']}" data-field="status">
                                </div>
                            </div>
                            <div class="apply_code">
                                <div class="form-group">
                                    <label class="control-label col-md-2 col-sm-3 col-xs-12">短信接口</label>
                                    <div class="col-md-10 col-sm-9 col-xs-12 xradio" data-value="{$xc['code_type']}">
                                        <label class="radio inline">
                                            <input type="radio" class="ui-radio" name="xc[code_type]" value="1" {if $xc['code_type']==1}checked{/if}>阿里云
                                        </label>
                                        <label class="radio inline">
                                            <input type="radio" class="ui-radio" name="xc[code_type]" value="2" {if $xc['code_type']==2}checked{/if}>聚合数据
                                        </label>
                                    </div>
                                </div>
                                <div class="radiocontents">
                                    <div class="form-group">
                                        <label class="control-label col-md-2 col-sm-3 col-xs-12">AccessKeyId</label>
                                        <div class="col-md-10 col-sm-9 col-xs-12">
                                            <input type="text" class="form-control" name="xc[accesskeyid]" id="accesskeyid"
                                                   value="{$xc['accesskeyid']}">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label col-md-2 col-sm-3 col-xs-12">AccessKeySecret</label>
                                        <div class="col-md-10 col-sm-9 col-xs-12">
                                            <input type="text" class="form-control" name="xc[accesskeysecret]"
                                                   id="accesskeysecret" value="{$xc['accesskeysecret']}">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label col-md-2 col-sm-3 col-xs-12">短信签名</label>
                                        <div class="col-md-10 col-sm-9 col-xs-12">
                                            <input type="text" class="form-control" name="xc[sign]" id="sign"
                                                   value="{$xc['sign']}">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label col-md-2 col-sm-3 col-xs-12">模版CODE </label>
                                        <div class="col-md-10 col-sm-9 col-xs-12">
                                            <input type="text" class="form-control" name="xc[code]" id="code"
                                                   value="{$xc['code']}">
                                            <span class="help-block">模板变量：验证码为${code}</span>
                                        </div>
                                    </div>
                                </div>
                                <div class="radiocontents">
                                    <div class="form-group">
                                        <label class="control-label col-md-2 col-sm-3 col-xs-12">APPKEY </label>
                                        <div class="col-md-10 col-sm-9 col-xs-12">
                                            <input type="text" class="form-control" name="xc[appkey]" id="appkey"
                                                   value="{$xc['appkey']}">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label col-md-2 col-sm-3 col-xs-12">短信模板ID </label>
                                        <div class="col-md-10 col-sm-9 col-xs-12">
                                            <input type="text" class="form-control" name="xc[tpl_id]" id="tpl_id"
                                                   value="{$xc['tpl_id']}">
                                            <span class="help-block">模板变量：验证码为#code#</span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-2 col-sm-3 col-xs-12">提现功能</label>
                                <div class="col-md-10 col-sm-9 col-xs-12">
                                    <input type="checkbox" class="js-switch" value="1" name="xc[withdraw]"
                                           data-value="{$xc['withdraw']}" data-field="status">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-2 col-sm-3 col-xs-12">收款码</label>
                                <div class="col-md-10 col-sm-9 col-xs-12">
                                    <input type="checkbox" class="js-switch" value="1" name="xc[withdraw_code]"
                                           data-value="{$xc['withdraw_code']}" data-field="status">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-2 col-sm-3 col-xs-12">起提金额</label>
                                <div class="col-md-10 col-sm-9 col-xs-12">
                                    <div class="input-group">
                                        <input type="text" class="form-control" name="xc[withdraw_limit]" value="{$xc['withdraw_limit']}" placeholder="起提金额">
                                        <span class="input-group-btn">
                                            <button class="btn btn-default" type="button">元</button>
                                        </span>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-2 col-sm-3 col-xs-12">提现手续费</label>
                                <div class="col-md-10 col-sm-9 col-xs-12">
                                    <div class="col-md-10 col-sm-9 col-xs-12 xradio" data-value="{$xc['fee_type']}">
                                        <label class="radio inline">
                                            <input type="radio" class="ui-radio" name="xc[fee_type]" value="1" {if $xc['fee_type']==1}checked{/if}>无
                                        </label>
                                        <label class="radio inline">
                                            <input type="radio" class="ui-radio" name="xc[fee_type]" value="2" {if $xc['fee_type']==2}checked{/if}>固定金额
                                        </label>
                                        <label class="radio inline">
                                            <input type="radio" class="ui-radio" name="xc[fee_type]" value="3" {if $xc['fee_type']==3}checked{/if}>百分比
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group fee_type1">
                                <label class="control-label col-md-2 col-sm-3 col-xs-12">提现手续费</label>
                                <div class="col-md-10 col-sm-9 col-xs-12">
                                    <div class="input-group">
                                        <input type="text" class="form-control" name="xc[fee_price]" value="{$xc['fee_price']}" placeholder="提现手续费">
                                        <span class="input-group-btn">
                                            <button class="btn btn-default" type="button">元</button>
                                        </span>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group fee_type2">
                                <label class="control-label col-md-2 col-sm-3 col-xs-12">提现手续费</label>
                                <div class="col-md-10 col-sm-9 col-xs-12">
                                    <div class="input-group">
                                        <span class="input-group-btn">
                                            <button class="btn btn-default" type="button">提现金额的</button>
                                        </span>
                                        <input type="text" class="form-control" name="xc[fee_pro]" value="{$xc['fee_pro']}" placeholder="百分比">
                                        <span class="input-group-btn">
                                            <button class="btn btn-default" type="button">%</button>
                                        </span>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-2 col-sm-3 col-xs-12">提现说明</label>
                                <div class="col-md-10 col-sm-9 col-xs-12">
                                    {php echo tpl_ueditor('xc[withdraw_content]',$xc['withdraw_content']);}
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-2 col-sm-3 col-xs-12">用户协议</label>
                                <div class="col-md-10 col-sm-9 col-xs-12">
                                    <input type="checkbox" class="js-switch" value="1" name="xc[pro_status]"
                                           data-value="{$xc['pro_status']}" data-field="status">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-2 col-sm-3 col-xs-12">用户协议名称</label>
                                <div class="col-md-10 col-sm-9 col-xs-12">
                                    <input type="text" class="form-control" name="xc[pro_name]" value="{$xc['pro_name']}" placeholder="用户协议名称">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-2 col-sm-3 col-xs-12">用户协议内容</label>
                                <div class="col-md-10 col-sm-9 col-xs-12">
                                    {php echo tpl_ueditor('xc[pro_content]',$xc['pro_content']);}
                                </div>
                            </div>
                            <div class="form-group xc_btn_row">
                                <div class="col-md-9 col-sm-9 col-xs-12 col-md-offset-5 col-sm-offset-5  col-md-xs-5 ">
                                    <button type="button" class="btn btn-primary" id="btsave">确认</button>
                                    <a type="button" class="btn btn-default"  href="{php echo $this->createWebUrl($do, array('op'=>'edit','xtitleb'=> urlencode($xtitleb),'xtitlea'=>urlencode($xtitlea)));}" >返回</a>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{template 'common/editfoot'}
<script>
    $("#btsave").click(function () {
        xajaxfrom("#xc_form");
        return false;
    });
    function message(data) {
        $mesoption = {};
        if (data["status"] === 1) {
            if ($('[name="id"]').val() == ""||$('[name="id"]').val() == "0") {
                xc_form.reset();
                $(".container").find(".img-thumbnail").attr("src", "./resource/images/nopic.jpg");
                if( urobj.length>0){
                    for(var i=0;i<urobj.length;i++){
                        urobj[i].setContent("");
                    }
                }
            }
            $mesoption["timer"] = 1000;
            $mesoption["type"] = replyrdata[data["status"]];
        }
        if( typeof(data["title"])=="undefined" )
        {
            $mesoption["title"] = data["message"];
        }
        else {
            $mesoption["title"]=data["title"];
        }
        $mesoption["text"] = data["message"];
        swal($mesoption);
    }
    function xajaxfrom(form) {
        $actfrom = $(form);
        var  $postdate=$actfrom.serialize();
        xpagecss.xload();
        $.ajax({
            type: $(form).attr("method"),
            url: $(form).attr("action"),
            dataType: "json",
            data: $postdate,
            success: function (msg) {
                message(msg)
            }
        });
    }
    function getJson(){

    }
</script>
<script>
    function type(){
        var index= $('[name="xc[type]"]:checked').val();
        if(index==1){
            $(".type1").show();
            $(".type2").hide();
            $(".type3").hide();
        }else if(index==2){
            $(".type1").show();
            $(".type2").show();
            $(".type3").hide();
        }else if(index==3){
            $(".type1").show();
            $(".type2").show();
            $(".type3").show();
        }
    }
    function apply_code(){
        if($("input[name='xc[apply_code]']").is(":checked")){
            $(".apply_code").show();
        }else{
            $(".apply_code").hide();
        }
    }
    function print(){
        var type=$("input[name='xc[code_type]']:checked").val();
        $(".radiocontents").hide();
        $(".radiocontents").eq(type-1).show();
    }
    function fee_type(){
        var type= $('[name="xc[fee_type]"]:checked').val();
        if(type==1){
            $(".fee_type1").hide();
            $(".fee_type2").hide();
        }else if(type==2){
            $(".fee_type1").show();
            $(".fee_type2").hide();
        }else if(type==3){
            $(".fee_type1").hide();
            $(".fee_type2").show();
        }
    }
    print();
    type();
    apply_code();
    fee_type();
    $(function(){
        $("input[name='xc[type]']").change(function(){
            type();
        });
        $("input[name='xc[apply_code]']").change(function(){
            apply_code();
        });
        $("input[name='xc[code_type]']").change(function(){
            print();
        });
        $("input[name='xc[fee_type]']").change(function(){
            fee_type();
        });
    })
</script>
</body>
</html>